<?php 
   // debug($student);
?>
<div class="students form">
<fieldset>
 <legend><?php __('<b>Информация о студенте</b>');?></legend>
 <div class="art-Post">
	<div class="art-Post-body">
		<div class="art-Post-inner">
			<div class="art-PostContent">
            <table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td rowspan="7" align="left" valign="top" width="110">
    <?php 
			echo $html->image(array('controller'=>'studentinfos','action'=>'showimage', $student[0]['Studentinfo']['student_id']), array('alt' => 'Фото студента', 'width' => 150, 'height' => 200, 'border' => 1));
		?>
		<p>
		<?php 
			echo $form->create('Studentfoto', array('action' =>'changefoto'));
			echo $form->hidden('student_id', array('value' => $student[0]['Studentinfo']['student_id']));
			echo $form->end('Изменить фото студента');
		?>
		</p>
    </td>
    <td width="15%" class="labelblock">ФАМИЛИЯ</td>
    <td colspan="4" class="infoblock"><?php  echo $student[0]['Studentinfo']['lastname']; ?></td>
    <td width="15%" class="labelblock">ФАКУЛЬТЕТ</td>
    <td width="25%" class="infoblock"><?php echo $profession[0]['Facultet']['name']; ?></td>
  </tr>
  <tr>
    <td width="15%" class="labelblock">ИМЯ</td>
    <td colspan="4" class="infoblock"><?php echo $student[0]['Studentinfo']['firstname']; ?></td>
    <td width="15%" class="labelblock">СПЕЦИАЛЬНОСТЬ</td>
    <td width="25%" class="infoblock"><?php echo $profession[0]['Profession']['name']; ?></td>
  </tr>
  <tr>
    <td width="15%" class="labelblock">ОТЧЕСТВО</td>
    <td colspan="4" class="infoblock"><?php echo $student[0]['Studentinfo']['surname']; ?></td>
    <td width="15%" class="labelblock">КУРС</td>
    <td width="25%" class="infoblock"><?php echo $courses[$studentgroup[0]['Studentgroup']['course_id']]; ?></td>
    </tr>
  <tr>
    <td width="15%" class="labelblock">ДАТА РОЖДЕНИЯ</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['birthdate']; ?></td>
    <td class="labelblock">ПОЛ</td>
    <td colspan="2"  class="infoblock"><?php echo $genders[$student[0]['Studentinfo']['gender_id']]; ?></td>
    <td width="15%" class="labelblock">ГРУППА</td>
    <td width="25%" class="infoblock"><?php echo $studentgroup[0]['Studentgroup']['name']; ?></td>
    </tr>
  <tr>
    <td width="15%" class="labelblock">ДОКУМЕНТ ОБ ОБРАЗОВАНИИ</td>
    <td colspan="4" class="infoblock"><?php 
    if ($student[0]['Studentinfo']['educationdoctype_id']) {
    echo $educationdoctypes[$student[0]['Studentinfo']['educationdoctype_id']]; 	
    }
    ?></td>
    <td width="15%" class="labelblock">ГОД ПОСТУПЛЕНИЯ</td>
    <td width="25%" class="infoblock"><?php echo $student[0]['Studentinfo']['enrollment_date']; ?></td>
    </tr>
  <tr>
    <td width="15%" class="labelblock">ДАННЫЕ ДОК-ТА ОБ ОБРАЗОВАНИИ</td>
    <td colspan="6" class="infoblock"><?php echo $student[0]['Studentinfo']['educationdocdata']; ?></td>
    </tr>
  <tr>
    <td width="15%" class="labelblock">ГОД ОКОНЧАНИЯ ШКОЛЫ</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['schoolgraduated']; ?></td>
    <td class="labelblock">ТИП ОБУЧЕНИЯ</td>
    <td colspan="2" class="infoblock"><?php echo $learningtypes[$student[0]['Student']['learningtype_id']]; ?></td>
    <td width="15%" class="labelblock">ФОРМА ОБУЧЕНИЯ</td>
    <td width="25%" class="infoblock"><?php echo $learningforms[$student[0]['Student']['learningform_id']]; ?></td>
  </tr>
  <tr>
    <td class="labelblock">ЦЕЛЕВОЕ НАПР.</td>
    <td colspan="2"  class="infoblock"><?php if ($student[0]['Targetingintake']){
    	echo $regions[$student[0]['Targetingintake'][0]['region_id']];
    	echo '<br>';
    	echo $student[0]['Targetingintake'][0]['info'];
    } 
    ?>    </td>
    <td class="labelblock">ОБЛАСТЬ </td>
    <td colspan="2" class="infoblock"><?php echo $student[0]['Region']['name']; ?></td>
    <td class="labelblock">ИН. ЯЗ.</td>
    <td class="infoblock"><?php echo $student[0]['Foreignlanguage']['name']; ?></td>
  </tr>
  <tr>
  <td class="labelblock">ЛЬГОТЫ
  </td>
  <td class="infoblock" colspan="3"><?php 
  		$privileges = $student[0]['Privilege'];
  		foreach ($privileges as $privilege):
			echo $privilege['name'];
			echo '<br />' ;
  		endforeach;
  ?>
  </td>
  <td colspan="5">&nbsp;</td>
  </tr>
</table>
  <br clear="all" />
  <table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td class="labelblock">ГРАЖДАНСТВО</td>
    <td class="infoblock"><?php if ($student[0]['Studentinfo']['citizenship_id']) {
    	echo $citizenships[$student[0]['Studentinfo']['citizenship_id']];
    }  ?></td>
    <td class="labelblock">КЕМ ВЫДАН</td>
    <td colspan="5" class="infoblock"><?php echo $student[0]['Studentinfo']['passport_data']; ?></td>
  </tr>  
  <tr>
    <td width="15%" class="labelblock">ПАСПОРТ СЕРИЯ</td>
    <td width="10%" class="infoblock"><?php echo $student[0]['Studentinfo']['passport_ser']; ?></td>
    <td width="10%" class="labelblock">НОМЕР</td>
    <td width="10%" class="infoblock"><?php echo $student[0]['Studentinfo']['passport_num']; ?></td>
    <td width="10%" class="labelblock">МЕСТО РОЖД.</td>
    <td colspan="3" class="infoblock"><?php echo $student[0]['Studentinfo']['passport_birth_place']; ?></td>
    </tr>
  <tr>
    <td colspan="2" class="labelblock">АДРЕС ПОСТОЯННОЙ РЕГИСТРАЦИИ</td>
    <td colspan="6" class="infoblock"><?php echo $student[0]['Studentinfo']['passport_adress']; ?></td>
    </tr>
  <tr>
    <td colspan="2" class="labelblock">АДРЕС ФАКТИЧЕСКОГО ПРОЖИВАНИЯ</td>
    <td colspan="6" class="infoblock"><?php echo $student[0]['Studentinfo']['adress']; ?></td>
    </tr>
  <tr>
    <td class="labelblock">ТЕЛЕФОН</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['phone']; ?></td>
    <td class="labelblock">МОБ. ТЕЛЕФОН</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['mobile']; ?></td>
    <td class="labelblock">ЭЛ. ПОЧТА</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['email']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </table>
   <br clear="all" />
<table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
  <td width="25%" class="labelblock">ИНН</td>
  <td width="25%" class="infoblock"><?php echo $student[0]['Studentinfo']['inn']; 
  ?></td>
  <td width="25%" class="labelblock">ПЕНС. СВ-ВО (СНИЛС)</td>
  <td width="25%" class="infoblock"><?php echo $student[0]['Studentinfo']['pension_certificate'];
  ?>
  </td>
  </tr>
  <tr>
    <td class="labelblock">МЕД. ПОЛИС</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['insurance']; 
  ?></td>
    <td class="labelblock">ПРИВИВКИ</td>
    <td class="infoblock"><?php echo $student[0]['Studentinfo']['inoculations']; 
  ?></td>
  </tr>
  <tr>
    <td class="labelblock">ДОП. ИНФОРМАЦИЯ</td>
    <td colspan="3" class="infoblock"><?php echo $student[0]['Studentinfo']['moreinfo']; 
  ?></td>
  </tr>
</table> 
<br clear="all" />
<table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#CCCCCC">

</table> 
<?php 
	if ($student[0]['Relative']){
	$relatives = $student[0]['Relative'];
	foreach ($relatives as $relative): 

?>
<table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#cccccc">
  <tr> 
  	<td class="labelblock">
  		РОДСТВЕННИК
  	</td>
  	<td colspan="4">&nbsp;
  		
  	</td>
  </tr>
  <tr>
    <td width="15%" class="labelblock"><?php echo $relativestypes[$relative['relativestype_id']]; ?></td>
    <td width="45%" class="infoblock"><?php echo $relative['fio']; ?></td>
    <td width="15%" class="labelblock">ТЕЛЕФОНЫ</td>
    <td class="infoblock"><?php echo $relative['phone']; ?></td>
    <td class="infoblock"><?php echo $relative['mobile']; ?></td>
  </tr>
  <tr>
    <td width="15%" class="labelblock">МЕСТО РАБОТЫ</td>
    <td width="45%" class="infoblock"><?php echo $relative['job']; ?></td>
    <td width="15%" class="labelblock">ДОЛЖНОСТЬ</td>
    <td colspan="2" class="infoblock"><?php echo $relative['jobstatus']; ?></td>
    </tr>
  <tr>
    <td width="15%" class="labelblock">ПАСПОРТНЫЕ ДАННЫЕ</td>
    <td width="45%" class="infoblock"><?php echo $relative['passport_data']; ?></td>
    <td width="15%" class="labelblock">АДРЕС</td>
    <td colspan="2" class="infoblock"><?php echo $relative['adress']; ?></td>
    </tr>
</table>
<?php 
endforeach;
	} // if
?>
<br clear="all" />
<?php 
	if ($student[0]['Mate']){
		$mates = $student[0]['Mate'];
		foreach ($mates as $mate):
?>	
		<table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#cccccc">
			<tr>
				<td colspan="4"><b>СУПРУГ</b></td>
			</tr>			
			<tr>
				<td width="15%" class="labelblock">ФИО</td>
				<td width="35%" class="infoblock">
					<?php 
						echo $mate['fio'];
					?>
				</td>
				<td width="15%" class="labelblock">СТАТУС</td>
				<td width="35%" class="infoblock">
					<?php 
						echo $matestatuses[$mate['matestatus_id']];
					?>
				</td>
			</tr>
			<tr>
				<td class="labelblock">ПАСПОРТ. ДАННЫЕ</td>
				<td colspan="3" class="infoblock">					
					<?php 
						echo $mate['passport_data'];
					?>
				</td>
			</tr>
		</table>
<?php 
	endforeach;
	} // if 
?>
<br clear="all" /> 
<?php 
	if ($student[0]['Baby']){
		$babies = $student[0]['Baby'];
		foreach ($babies as $baby):
		?>
		<table width="100%" border="0" cellspacing="10" cellpadding="0" bgcolor="#cccccc">
			<tr>
				<td colspan="2"><b>РЕБЕНОК</b></td>
			</tr>			
			<tr>
				<td width="25%" class="labelblock">ДАТА РОЖДЕНИЯ РЕБЕНКА</td>
				<td class="infoblock">
					<?php 
						echo $baby['birthdate'];
					?>
				</td>
			</tr>
			<tr>
				<td class="labelblock">ИНФОРМАЦИЯ</td>
				<td class="infoblock">					
					<?php 
						echo $baby['info'];
					?>
				</td>
			</tr>
		</table>
<?php 
	endforeach;
	} // if 
?>		
<br clear="all" />  
				<h2>Приказы по студенту</h2>
				<table width="70%" border="1" cellspacing="2" cellpadding="2" class='art-article'>
				  <tr>
				    <td width="50%" align="center"><b>Тип приказа</b></td>
				    <td width="10%" align="center"><b>Дата</b></td>
				    <td width="10%" align="center"><b>номер</b></td>
				    <td width="30%" align="center"><b>Доп. информация</b></td>
				  </tr>
				<?php 
					foreach ($orders as $order):
						echo '<tr>';
						echo '<td width="50%" align="center">'.$listordertypes[$order['Order']['ordertype_id']].'</td>' ;
						echo '<td width="25%" align="center">'.$order['Order']['date'].'</td>' ;
				    	echo '<td width="25%" align="center">'.$order['Order']['number'].'</td>'; 
				    	echo '<td width="25%" align="center">'.$order['Order']['order_info'].'</td>';
				    	echo '</tr>'; 
					endforeach;
				?>
				</table>
          </div>
		</div>
	</div>
</div>    
 	</fieldset>
</div>
<div>
<?php 
	if ($student[0]['Contract']){
		echo '<fieldset>';
		echo '<legend>Данные договора о внебюджетном обучении</legend>';
		echo '<br />';
		echo '<div>&nbsp;&nbsp;&nbsp;&nbsp;'.$student[0]['Contract'][0]['data'].'</div>';
		echo '<br />';
		echo '</fieldset>';
	}
?>
</div>
<br clear="all" />  
<div>

<br clear="all" /> 
<div class="studentinfo form">
<fieldset>
 <legend>Редактировать информацию о студенте
 </legend>
	<?php 
		echo $form->create('Studentinfo', array('action' =>'edit/'.$student[0]['Studentinfo']['id']));
		//echo $form->hidden('id', array('value' => $student[0]['Studentinfo']['id']));
		echo $form->end('Редактировать информацию о студенте');
	?>	
</fieldset>
</div>